package com.cdcas.dept;

import com.cdcas.dept.utils.BeanUtil;

import java.lang.reflect.InvocationTargetException;

public class ObjectInstanceFactory {

    private ObjectInstanceFactory(){}
    public static <T> T create(Class<?> clazz,String value) {
        Object object = null;
        try {
            object = clazz.getDeclaredConstructor().newInstance();
            BeanUtil.setObjectValue(object,value);
            return (T)object;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}
